Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EEI: add isAccountEmpty method #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

s1na
Copy link

@s1na s1na commented Apr 11, 2019

This method is required for metering CALL in runevm/evm2ewasm (#138 and axic/runevm#18 for some context), and can also be used in implementingEXTCODEHASH (without adding an additional method to EEI).

I believe #112 could alternatively also solve this problem. I'm not sure however what's the consensus on that.

@axic
Copy link
Member

axic commented May 29, 2019

How about accountState, which returns:

  • 0: empty
  • 1: external (exists, but has no code)
  • 2: contract (exists, but has code)
  • 3: evicted (state-rent, this is the state before it is fully pruned?)

@chfast what do you think?

@axic
Copy link
Member

axic commented May 29, 2019

@s1na cannot you emulate this feature by externalBalance() != 0 || extcodeHash() != 0 ?

@axic
Copy link
Member

axic commented May 29, 2019

Hm, perhaps we just need to implement #183, because that brings in EXTCODEHASH which supposed to be able to tell if an account exists: https://eips.ethereum.org/EIPS/eip-1052

@chfast
Copy link
Collaborator

chfast commented May 29, 2019

  1. In EVMC it is called account_exists() although it works the same as described here.
  2. You will need it to price CALL and SELFDESTRUCT.
  3. In theory you can use that to implement EXTCODEHASH by hashing the code in the VM, but EXTCODEHASH assumes the hash is already known in the state and no hashing is required.
  4. I'm rather for adding simple method as proposed here.

Returning all account information at once was proposed here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants